from django.contrib import admin
from ourcity.reps import models

class PartyAdmin(admin.ModelAdmin):
    pass
admin.site.register(models.Party, PartyAdmin)

class OfficeAdmin(admin.ModelAdmin):
    pass
admin.site.register(models.Office, OfficeAdmin)

class DistrictAdmin(admin.ModelAdmin):
    pass
admin.site.register(models.District, DistrictAdmin)

class DistrictTypeAdmin(admin.ModelAdmin):
    pass
admin.site.register(models.DistrictType, DistrictTypeAdmin)

class DistrictSubTypeAdmin(admin.ModelAdmin):
    pass
admin.site.register(models.DistrictSubType, DistrictSubTypeAdmin)

class DonationAdmin(admin.ModelAdmin):
    list_display = ('representative', 'donor', 'amount')
    ordering = ('representative',)
admin.site.register(models.Donation, DonationAdmin)

class DonorAdmin(admin.ModelAdmin):
    search_fields = ('name',)
admin.site.register(models.Donor, DonorAdmin)

class RepAdmin(admin.ModelAdmin):
    list_display = ('last_name', 'first_name', 'office', 'district', 'party', 'active')
    list_editable = ('active', )
    list_filter = ('active', 'party', 'office', 'district', 'candidate_election')
    fieldsets = (
        (None, {
            'fields': ('active', 'photo', 'info', 'donor_years'),
        }),
        ('Candidate fields', {
            'fields': ('candidate_election', 'candidate_district', 
                'candidate_office', 'candidate_party'),
        }),
        ('Cicero fields -- will get overwritten on update', {
            'classes': ('collapse',),
            'fields': ('assembly_name', 'committees', 'country', 'description',
                'district', 'elected_official_id', 'email1', 'email2', 
                'first_name', 'last_name', 'last_update_date', 
                'middle_initial', 'name_suffix', 'party', 'primary_address1',
                'primary_address2', 'primary_address3', 'primary_city', 
                'primary_fax1', 'primary_fax2', 'primary_phone1', 
                'primary_phone2', 'primary_postal_code', 'primary_state',
                'salutation', 'secondary_address1', 'secondary_address2', 
                'secondary_address3', 'secondary_city', 'secondary_fax1', 
                'secondary_fax2', 'secondary_phone1', 'secondary_phone2', 
                'secondary_postal_code', 'secondary_state', 'term_end_date',
                'term_end_date_precision', 'term_start_date', 
                'term_start_date_precision', 'title', 'office', 'url1', 'url2'),
        }),
    )
admin.site.register(models.Representative, RepAdmin)

